<script src="js/jquery-1.5.1.js"></script>
<script src="js/product.js"></script>
<h1>Products </h1>
<div style="background-color: red;display: none" id="pop"></div>
<table border="0">
        <?php
        for ($i=0;$i<sizeof($this->data);$i+=3)//
        {
                echo $i;
                ?>
        <tr>
                <?php
                        //$tdNumber = 3 ? (($i+3)<sizeof($this->data)) : (sizeof($this->data)-$i);
                        if(($i+3)<sizeof($this->data))
                                $tdNumber=3;
                        else
                                $tdNumber=(sizeof($this->data)-$i);

                        for($j=0;$j<$tdNumber;$j++)
                        {
                ?>
                <td>

                        <table id="Table_01" width="183" height="248" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td colspan="8">
			<img src="<?php echo $this->baseUrl() ?>/images/table_01.gif" width="183" height="10" alt=""></td>
	</tr>
	<tr>
		<td rowspan="8">
			<img src="<?php echo $this->baseUrl() ?>/images/table_02.gif" width="8" height="237" alt=""></td>
		<td colspan="6" background="<?php echo $this->baseUrl() ?>/images/title.gif" width="166" height="30">
                <?=$this->data[$j+$i]['name']?>
		</td>
		<td rowspan="8">
			<img src="<?php echo $this->baseUrl() ?>/images/table_04.gif" width="9" height="237" alt=""></td>
	</tr>
	<tr>
		<td colspan="6">
			<img src="<?php echo $this->baseUrl() ?>/images/table_05.gif" width="166" height="9" alt=""></td>
	</tr>
	<tr>
		<td rowspan="6">
			<img src="<?php echo $this->baseUrl() ?>/images/table_06.gif" width="3" height="198" alt=""></td>
		<td colspan="3" background="<?php echo $this->baseUrl() ?>/images/body.gif" width="157" height="125">
                  <a href="<?php echo $this->url(array("url" => $item['id'],"action" => "show","controller" => "product"))?>">
                    <img src="<?php echo $this->baseUrl() ?>/product_images/<?=$this->data[$j+$i]['image']?>" width="100" height="100" />
                  </a>
		</td>
		<td colspan="2" rowspan="4">
			<img src="<?php echo $this->baseUrl() ?>/images/table_08.gif" width="6" height="159" alt=""></td>
	</tr>
	<tr>
		<td colspan="3">
			<img src="<?php echo $this->baseUrl() ?>/images/table_09.gif" width="157" height="4" alt=""></td>
	</tr>
	<tr>
		<td rowspan="2">
			<img src="<?php echo $this->baseUrl() ?>/images/table_10.gif" width="6" height="30" alt=""></td>
		<td background="<?php echo $this->baseUrl() ?>/images/price.gif" width="79" height="24">
                <?=$this->data[$j+$i]['price']?>
		</td>
		<td rowspan="2">
			<img src="<?php echo $this->baseUrl() ?>/images/table_12.gif" width="72" height="30" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/table_13.gif" width="79" height="6" alt=""></td>
	</tr>
	<tr>
		<td colspan="4"  rel="<?=$this->data[$j+$i]['id']?>" id="addtoshoping"   background="<?php echo $this->baseUrl() ?>/images/addButton.gif" width="161" height="29">
		<!-- make it submit button or link on img as u wish -->
		</td>
		<td rowspan="2">
			<img src="<?php echo $this->baseUrl() ?>/images/table_15.gif" width="2" height="39" alt=""></td>
	</tr>
	<tr>
		<td colspan="4">
			<img src="<?php echo $this->baseUrl() ?>/images/table_16.gif" width="161" height="10" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/spacer.gif" width="8" height="1" alt=""></td>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/spacer.gif" width="3" height="1" alt=""></td>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/spacer.gif" width="6" height="1" alt=""></td>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/spacer.gif" width="79" height="1" alt=""></td>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/spacer.gif" width="72" height="1" alt=""></td>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/spacer.gif" width="4" height="1" alt=""></td>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/spacer.gif" width="2" height="1" alt=""></td>
		<td>
			<img src="<?php echo $this->baseUrl() ?>/images/spacer.gif" width="9" height="1" alt=""></td>
	</tr>
</table>
                </td>
                <?php
                        }
                ?>
        </tr>
        <?php
        }
        ?>
</table>